package org.itboys.core.service.mongo.web;

import org.itboys.core.common.SundayCommonConstants;
import org.itboys.core.entity.mongo.SundayInvoice;
import org.itboys.mongodb.core.MongoDataSource;
import org.itboys.mongodb.service.BaseMongoService;
import org.itboys.param.PageResult;
import org.itboys.param.ParamUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @Author：贾琦磊
 * @Date：2018/12/5
 * @Description：web端发票
 */
@Service
public class SundayInvoiceService extends BaseMongoService<SundayInvoice>{
    @Resource(name = "mobileDs")
    private MongoDataSource sundayDataSource;
    @Override
    protected MongoDataSource getMongoDataSource() {
        return sundayDataSource;
    }

    @Override
    protected Class<SundayInvoice> getEntityClass() {
        return SundayInvoice.class;
    }


    public PageResult select(HttpServletRequest request){
        Map<String,Object> param = ParamUtil.packageMongoExactParam(request,"status","headType","type");
        param.put("isDeleted", SundayCommonConstants.NO);
        Map<String,String> containsparam = ParamUtil.packageMongoVagueParam(request);
        PageResult<SundayInvoice> result=super.containpageQuery(request,containsparam,param);
        return result;
    }
}
